/*package com.fas.core.web.taglib;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

import com.jfinal.kit.StrKit;
import com.knight.canting.core.constant.Keys;
import com.knight.canting.core.web.response.BaseResult;
import com.knight.canting.core.web.response.ResultStatus;

public class MsgTag extends TagSupport {

	private static final long serialVersionUID = 1L;
	private String key;
	@Override
	public int doStartTag() throws JspException {
		JspWriter out = pageContext.getOut();
		
		if(StrKit.isBlank(key)){
			key = Keys.DEFAULT_MSGTAG_KEY;
		}
		
		BaseResult result= (BaseResult)pageContext.getRequest().getAttribute(key);
		if(null == result){
			return super.doStartTag();
		}
		try {
			StringBuffer sb = new StringBuffer();
			sb.append("<div class='");

			if (result.getStatus() == ResultStatus.SUCCESS) {
				sb.append("alert alert-success");
			} else if (result.getStatus() == ResultStatus.ERROR) {
				sb.append("alert alert-danger");
			} else {
				sb.append("alert alert-info");
			}
			sb.append("'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>");
			sb.append("<strong>").append(result.getMessage()).append("</strong></div>");
			
			out.print(sb.toString());
		} catch (IOException e) {
			e.printStackTrace();
		}
		return super.doStartTag();
	}

}
*/